<%--
  Created by IntelliJ IDEA.
  User: hanfei
  Date: 18/7/25
  Time: 下午2:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="com.wuming.house.security.SecurityHander" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>功能管理</title>
    <link rel="stylesheet" href="${allServerPath}static/layui/layui/css/layui.css">
    <link rel="stylesheet" href="${allServerPath}static/layui/css/icon.css">
    <link rel="stylesheet" href="${allServerPath}static/layui/css/public.css">
</head>
<body style="background-color: #f0f2f5;" class="childrenBody">
<div class="layui-fluid wuli-main">
    <div class="layui-row">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>功能管理</legend>
        </fieldset>
        <form class="layui-form">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label wuli-width-auto">首页广告弹窗</label>
                    <input type="checkbox" name="advertisement" lay-skin="switch" lay-filter="advertisement" lay-text="开启|关闭">
                </div>
            </div>
        </form>
    </div>
    <div class="layui-row wuli-button">
        <button id="system" type="button" class="layui-btn layui-btn-normal">配置广告</button>
        <%--<button id="btnExport" type="button" class="layui-btn layui-btn-normal">导出表单</button>--%>
    </div>
    <div class="layui-row">
        <table class="layui-hide" id="reportInfo" lay-data="{height: 'full-200'}" lay-filter="reportinfo"></table>
        <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    </div>
</div>

<script src="${allServerPath}static/layui/layui/layui.js"></script>
<script type="text/html" id="imageTpl">
    <img src="{{d.imagePath}}"/>
</script>
<script>
    layui.use(['form', 'laydate', 'table'], function () {
        var layer = layui.layer,
            form = layui.form
            $ = layui.$;

        $(document).ready(function () {
            $.ajax({
                type: "post",
                data: {
                    functionId: 1,
                },
                url: '${allServerPath}web/function/getFunction.htmls?t=<%=System.currentTimeMillis()%>',
                success: function (obj) {
                    if (obj.data.functionStatus==1){
                        $("input[name='advertisement']").attr("checked",true);
                        form.render();
                    }
                }
            });
        });

        $("#system").click(function () {
            layer.open({
                type: 2,
                title: '配置广告',
                maxmin: true,
                shadeClose: true, //点击遮罩关闭层
                area: ['500px', '480px'],
                content: '${allServerPath}web/function/toSystemBanner/1.htmls',
                end: function () {
                }
            });
        });

        form.on('switch(advertisement)', function (data){
            var status = 0;
            if (data.elem.checked) {
                status = 1;
            }
            console.log(status);
            $.ajax({
                type: "post",
                data: {
                    functionId: 1,
                    functionStatus : status
                },
                url: '${allServerPath}web/function/edit.htmls?t=<%=System.currentTimeMillis()%>',
                success: function (obj) {
                    if (obj.data.functionStatus==1){
                        $("input[name='']")
                    }
                }
            });
        });
    });
</script>
</body>
</html>

